package com.moon.admin.sys.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moon.admin.sys.entity.SysPostEntity;
/**
 * 岗位 数据层
 * 
 * @author ninglong
 */
 @Mapper
public interface SysPostMapper extends BaseMapper<SysPostEntity>{
	
	 /**
	  * 根据用户id，获取其所在岗位信息
	  */
	 @Select("select hp.*,(select deptName from sys_dept hd where hd.id=hp.deptId) from sys_post hp left join sys_user_post  hup on(hp.id=hup.postId) where hup.userId=#{userId}")
	 public List<SysPostEntity> getPostListByUserId(Integer userId);
}